home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000016_icon-group-sender _Mon Jul 19 21:24:57 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 20 Jul 1993 19:43:51 MST
  2. Date: 19 Jul 93 21:24:57 GMT
  3. From: walter!flaubert!norman@uunet.uu.net  (Norman Ramsey)
  4. Organization: Bellcore
  5. Subject: More on Icon performance
  6. Message-Id: <1993Jul19.212457.15962@walter.bellcore.com>
  7. Sender: icon-group-request@cs.arizona.edu
  8. To: icon-group@cs.arizona.edu
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12. I want to create dags, so that I need to check to see if the node I'm
  13. about to create already exists.  The best way I know of is to create a
  14. string that is a function of the node's elements, then look for that
  15. string in a table.  Does anyone else know a better way?
  16.  
  17. Here's what I'm doing:
  18.  
  19.   procedure newitem(nt, dotpos, cat)
  20.     static cache
  21.     initial { cache := table() }
  22.     s := nt || " " || image(cat) || " " || dotpos
  23.     /cache[s] := item(nt, dotpos, cat)
  24.     return cache[s]
  25.   end
  26.  
  27. Can anyone suggest something better?  I'm especially interested in
  28. something less wasteful of string space.
  29.  
  30. Norman
  31.  
  32. --
  33. Norman Ramsey
  34. norman@bellcore.com
  35.